Skip to content

Correctly implement δ-resolver lift for modules. - #22451

Merged
coqbot-app[bot] merged 1 commit into
rocq-prover:masterfrom
ppedrot:module-delta-resolver-proper-lift
Sep 9, 2026
Merged

Correctly implement δ-resolver lift for modules.#22451
coqbot-app[bot] merged 1 commit into
rocq-prover:masterfrom
ppedrot:module-delta-resolver-proper-lift

Conversation

@ppedrot

@ppedrot ppedrot commented Sep 9, 2026

Copy link
Copy Markdown
Member

Module δ-resolvers are morally a kind of substitution, associating a canonical name to some aliased constant. Functors and module types are function-like w.r.t. to resolvers, insofar as the name they introduce is bound and should be left alone. This is similar to the λ-calculus equation (λt){σ} ≡ λ(t{σ↑}) where substitutions must be lifted when going under a context.

Unfortunately, the resolver mechanism is not based on De Bruijn indices but names, and the implementation was implementing the lift in a broken way, by adding the trivial equivalence p ↦ p for some bound path p. As is expected, this does not play well with the usual algebraic operations one expect to apply to resolvers, leading to interesting breakage of invariants here and there. It did not seem enough to prove False though, just random anomalies and incompletenesses.

We fix this mess by introducing an explicit lift operation in δ-resolvers which is handled specifically by substitution. En passant, the internals of Mod_subst are horrendous as they rely on physical equality (!) for some reason, resulting in interesting eisenbugs while trying to change the implementation.

Fixes #22426: Self-equivalence within δ-resolvers not stable by aliasing.

Module δ-resolvers are morally a kind of substitution, associating
a canonical name to some aliased constant. Functors and module types
are function-like w.r.t. to resolvers, insofar as the name they introduce
is bound and should be left alone. This is similar to the λ-calculus
equation (λt){σ} ≡ λ(t{σ↑}) where substitutions must be lifted when going
under a context.

Unfortunately, the resolver mechanism is not based on De Bruijn indices
but names, and the implementation was implementing the lift in a broken
way, by adding the trivial equivalence p ↦ p for some bound path p.
As is expected, this does not play well with the usual algebraic
operations one expect to apply to resolvers, leading to interesting
breakage of invariants here and there. It did not seem enough to prove
False though, just random anomalies and incompletenesses.

We fix this mess by introducing an explicit lift operation in δ-resolvers
which is handled specifically by substitution. En passant, the internals
of Mod_subst are horrendous as they rely on physical equality (!) for some
reason, resulting in interesting eisenbugs while trying to change the
implementation.

Fixes rocq-prover#22426: Self-equivalence within δ-resolvers not stable by aliasing.
@ppedrot ppedrot added this to the 9.4+rc1 milestone Sep 9, 2026
@ppedrot
ppedrot requested a review from a team as a code owner September 9, 2026 08:51
@ppedrot ppedrot added kind: fix This fixes a bug or incorrect documentation. request: full CI Use this label when you want your next push to trigger a full CI. labels Sep 9, 2026
@coqbot-app coqbot-app Bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label Sep 9, 2026
@ppedrot

ppedrot commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Note that the example added after the fact in #22426 is not solved by this patch, so I'll put it in a different issue.

@SkySkimmer SkySkimmer self-assigned this Sep 9, 2026
@SkySkimmer

Copy link
Copy Markdown
Contributor

@coqbot merge now

@coqbot-app
coqbot-app Bot merged commit 5f7f494 into rocq-prover:master Sep 9, 2026
8 checks passed
@ppedrot
ppedrot deleted the module-delta-resolver-proper-lift branch September 9, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: fix This fixes a bug or incorrect documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Self-equivalence within δ-resolvers not stable by aliasing

2 participants